"""编写一个员工类(Employee), 每次实例化该类后会自动记录+1，要求最后统计输出员工类总共实例化了多少对象。"""


class Employee:
    instance_count = 0

    def __init__(self):
        """使用类变量来记录创建实例的个数,而不是实例变量"""
        Employee.instance_count += 1

    def sayHello(self):
        print('我是父类的sayHello')


def get_instance_count():
    return Employee.instance_count


if __name__ == '__main__':
    for i in range(10):
        e = Employee()

    e1 = Employee()
    count = get_instance_count()
    print(f'已经创建了{count}个员工实例')
